import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/login.vue'
import ShoppingCart from "@/views/shopping/ShoppingCart";
import ProductDisplay from "@/views/shopping/ProductDisplay";
import indexBody from "../views/indexBody";
import Profile from "@/views/profile/Profile";
import User_Portal from "../views/portal/User_Portal"
import User from "../views/portal/User"
import orderlist from "@/views/portal/orderList"
import UpdatePassword from "../views/portal/UpdatePassword"
import userAddress from "@/views/portal/userAddress"
import Wallet from "@/views/portal/Wallet";
import Cart from "../views/Cart"
import CheckOrder from "../views/CheckOrder";
import userMessage from "@/views/portal/userMessage";
Vue.use(VueRouter)

const routes = [


    //产品中间页面
    {
        path: '/',
        name: 'indexBody',
        component: indexBody
    },
    // 登陆页面
    {
        path: '/login',
        name: 'Login',
        component: Login,
        meta: {
            title: '小米-登陆'
        }
    },
    // 注册页面
    {
        path: '/register',
        name: 'Register',
        component: Login,
        meta: {
            title: '小米-注册'
        }
    },
    //购物车组件
    {
        path: '/ShoppingCart',
        name: 'ShoppingCart',
        component: ShoppingCart,
        meta: {
            title: '购物车'
        }
    },
    //购物车展示页
    {
        path: '/Cart',
        name: 'Cart',
        component: Cart,
        meta: {
            title: '点击加入购物车后'
        }
    },
    //确认订单
    {
        path: '/CheckOrder',
        name: 'CheckOrder',
        component: CheckOrder,
    },
    //产品展示页面
    {
        path: '/ProductDisplay',
        name: 'ProductDisplay',
        component: ProductDisplay
    },
     //个人信息页面
    {
        path: '/User_Portal',
        name: 'User_Portal',
        component: User_Portal,
        redirect: '/User_Portal/User' ,
        meta: {
            title: '个人中心'
        },
        children:
            [
                //我的个人中心
                {
                    path: 'User',
                    name: 'User',
                    component: User,
                    meta: {
                        title: '个人中心'
                    }
                },
                //我的订单
                {
                    path: 'orderlist',
                    name: 'orderlist',
                    component: orderlist,
                    meta: {
                        title: '我的订单'
                    }
                },
                //profile页面
                {
                    path: 'Profile',
                    name: 'Profile',
                    component: Profile
                },
                //修改密码页面
                {
                    path: 'UpdatePassword',
                    name: 'UpdatePassword',
                    component: UpdatePassword,
                    meta: {
                        title: '修改密码'
                    }
                },
                //我的收获地址页面
                {
                    path: 'userAddress',
                    name: 'userAddress',
                    component: userAddress,
                    meta: {
                        title: '收货地址'
                    }
                },
                //我的钱包页面
                {
                    path: 'Wallet',
                    name: 'Wallet',
                    component: Wallet,
                    meta: {
                        title: '我的钱包'
                    }
                },
                {
                    path: 'userMessage',
                    name: 'UserMessage',
                    component: userMessage,
                    meta: {
                        title: '消息通知'
                    }
                }
            ]
    },

]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
